<?php
namespace app\admin\controller;

use app\admin\model\AdviseModel;
use cmf\controller\AdminBaseController;

class AdviseController extends AdminBaseController
{
    public function index() {
        if($this->request->isPost()) {
            $arrData = $this->request->post();
            $arrData['status'] = 1;
            $arrData['uid'] = cmf_get_current_admin_id();
            $adviseModel = new AdviseModel();
            $flag = $adviseModel->allowField(true)->validate(true)->save($arrData);
            if($flag !== false) {
                $this->success('反馈成功！');
            }else{
                $this->error($adviseModel->getError());
            }
        }
        return $this->fetch();
    }
}
